<html>
<head><meta charset="utf-8"><title>IntoFuture · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html">IntoFuture</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="176270810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/IntoFuture/near/176270810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> theduke <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html#176270810">(Sep 21 2019 at 16:14)</a>:</h4>
<p>The original async/await RFC specifies await (well, the macro variant) to go through a IntoFuture trait (<a href="https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#the-expansion-of-await" target="_blank" title="https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#the-expansion-of-await">see RFC</a>).</p>
<p>Is there a reason why this wasn't implemented, or is this an oversight?</p>
<p>The context is <a href="https://blog.yoshuawuyts.com/surf/" target="_blank" title="https://blog.yoshuawuyts.com/surf/">a blog post</a> which gave me the idea for an IntoFuture trait, but someone pointed out that it actually was already in the RFC.</p>
<p>It's very convenient functionality. </p>
<p>This seems like something that could also be added retroactively if need be, but I though I'd ask here, with the beta cutoff looming.</p>



<a name="176363697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/IntoFuture/near/176363697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html#176363697">(Sep 23 2019 at 12:33)</a>:</h4>
<p>It was removed at some point, but before I got involved; I believe <span class="user-mention" data-user-id="203289">@boats</span> or <span class="user-mention" data-user-id="127859">@Taylor Cramer</span> could expand.</p>



<a name="176412518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/IntoFuture/near/176412518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> boats <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html#176412518">(Sep 23 2019 at 21:44)</a>:</h4>
<p>We found in futures 0.2 that it was not needed. In 0.1, when future incorporated the error into its type, Result implemented <code>IntoFuture</code>, but in 0.2, there was nothing that did other than futures</p>



<a name="176412814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/IntoFuture/near/176412814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html#176412814">(Sep 23 2019 at 21:48)</a>:</h4>
<p>(nit: futures and tuples)</p>



<a name="176412841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/IntoFuture/near/176412841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Taylor Cramer <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html#176412841">(Sep 23 2019 at 21:48)</a>:</h4>
<p>but yeah, <span class="user-mention" data-user-id="203289">@boats</span>'s summary is correct</p>



<a name="176437936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/IntoFuture/near/176437936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> theduke <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/IntoFuture.html#176437936">(Sep 24 2019 at 07:03)</a>:</h4>
<blockquote>
<p>there was nothing that did other than futures</p>
</blockquote>
<p>The blog post outlines the use case where I also personally would have wanted this numerous times: being able to <code>.await</code> on a builder type structs, like http/db request builders.</p>
<p>Without this it requires either always calling a finalizer method like <code>.send()</code>, or keeping an <code>Option&lt;MyFuture&gt;</code> on the builder and checking it on every poll. </p>
<p><code>IntoFuture</code> would be a pretty big ergonomics win.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>